/**
 *
 * @class TabPanel
 * @extends Ext.TabPanel
 * @namespace dgest.com
 * @author Carlo Di Fulco
 */
 
Ext.ns('app.widgets'); 


app.widgets.TabPanel = Ext.extend(Ext.TabPanel, {
 
    border:false
    ,activeTab: 0
    ,resizeTabs      : true
	,minTabWidth     : 75
    
    /**
     * Panel conenente la homepage dell'applicazione
     * @cfg home 
     */
     
    ,initComponent:function() {
    	 
        var config = this.createConfig();
 
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);
        app.widgets.TabPanel.superclass.initComponent.apply(this, arguments);
 
        this.initHome(); 
        
    } 

    ,setHome : function(home){
    	if(this.home) this.remove(this.home);
    	this.home = home; 
    	this.home.closable = false;
		this.add( this.home ); 
    }

    /*
     * Utils :
     */
    
    , createConfig : function(){
    	
    	var tabScroll =  new Ext.ux.TabScrollerMenu({
    		maxText : 15,
    		pageSize : 5
    	});
    	
    	var config = {
			plugins : [new Ext.ux.TabCloseMenu(),tabScroll],
			enableTabScroll : true, 
			defaults : { closable : true }
        }; 
    	
    	return config; 
    }
    
    , initHome : function(){
    	if(this.home) { 
    		this.home.closable = false;
    		this.add( this.home ); 
        }
    }
}); 
 
Ext.reg('apptabpanel', app.widgets.TabPanel); 